package org.example.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@ApiModel(description = "订单实体")
public class Order {
    @ApiModelProperty(value = "订单ID", example = "1")
    private Long id;

    @ApiModelProperty(value = "用户ID", example = "1", required = true)
    private Long userId;

    @ApiModelProperty(value = "订单总金额", example = "9999.99", required = true)
    private BigDecimal totalAmount;

    @ApiModelProperty(value = "订单状态", example = "PENDING", required = true)
    private OrderStatus status;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "订单项列表")
    private List<OrderItem> orderItems;

    public enum OrderStatus {
        PENDING,    // 待支付
        PAID,       // 已支付
        SHIPPED,    // 已发货
        DELIVERED,  // 已送达
        COMPLETED,  // 已完成
        CANCELLED   // 已取消
    }
}

@Data
@ApiModel(description = "订单项实体")
class OrderItem {
    @ApiModelProperty(value = "订单项ID", example = "1")
    private Long id;

    @ApiModelProperty(value = "商品ID", example = "1", required = true)
    private Long productId;

    @ApiModelProperty(value = "商品数量", example = "2", required = true)
    private Integer quantity;

    @ApiModelProperty(value = "商品单价", example = "6999.99", required = true)
    private BigDecimal price;

    @ApiModelProperty(value = "小计金额", example = "13999.98", required = true)
    private BigDecimal subtotal;
} 